package ch.bfh.medinfo.javafx.dice.a_1;

import java.net.URL;
import java.util.ResourceBundle;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import ch.bfh.medinfo.javafx.dice.definition.Dice;
import ch.bfh.medinfo.javafx.dice.implementation.FairDice;

public class DiceController {
	private Dice dice;

	public DiceController() {
		this.dice = new FairDice(1, 6);

	}

	@FXML
	private ResourceBundle resources;

	@FXML
	private URL location;

	@FXML
	private Label labelActualValueId;

	@FXML
	void play(ActionEvent event) {
		playDice();
	}

	@FXML
	void initialize() {
		assert labelActualValueId != null : "fx:id=\"labelActualValueId\" was not injected: check your FXML file 'DiceLayout.fxml'.";
	}

	public void playDice() {
		dice.play();
		labelActualValueId.setText("" + dice.getActualValue());
	}

}
